<template>
  <view class="work-container">	
	<view>
		<view class="cardTitleBox">
			<text class="cardTitle">{{typeName}}</text>
		</view>
			<u-list @scrolltolower="scrolltolower" style="height: 350rpx;">
				    <u-list-item v-for="(item, index) in infos" :key="index" >
						<u-cell-group>
							<u-cell :title="item.name" :titleStyle="{color:item.categoryColor}"  :value="item.communityName"  @click="showInfo(item)" ></u-cell>
						</u-cell-group>
				    </u-list-item>
			</u-list>
			<u-loadmore :loadmoreText="status" color="#1CD29B"	lineColor="#1CD29B"	dashed	line />
	</view>  
  </view>
</template>

<script>
import { getInfos } from "@/api/info/info"
  export default {
    data() {
      return {
		status: '看,我和别人不一样',
		loadingText: '努力加载中',
		loadmoreText: '轻轻上拉',
		nomoreText: '实在没有了',
        current: 0,
        swiperDotIndex: 0,
		data:[],
		category:[],
		infos:[],
		notices:[],
		isRefreshing: false,
		page: 1,
		pageSize: 10,
		typeName:'',
		typeId:''
      }
    },
	onLoad(options) {
		this.typeName=options.name;
		this.typeId=options.typeId;
		this.getInfoIndex();
	},
    methods: {
		scrolltolower(){
				this.loadMore()
			},
			
		async loadMore() {
			this.page++;
			this.status=this.loadingText;
			const data = await getInfos({pageSize:this.pageSize,pageNum:this.page,type:this.typeId});
			if(this.infos.length==data.total){
				this.status=this.nomoreText;
			}else{
				data.rows.forEach((item, index) => {
					this.infos.push(item);
				});
				this.status=this.status
			}
		 },
		
		getInfoIndex(){
			getInfos({pageSize:this.pageSize,pageNum:this.page,type:this.typeId}).then(res=>{
				this.infos=res.rows
			})
		},
		
	  showInfo(item){
		  this.$tab.navigateTo(`/pages/common/content/index?infoId=${item.infoId}`)
	  },
     
    }
  }
</script>

<style lang="scss">
.cardTitleBox {
				background-color: rgba(72, 186, 91, 0.1);
				border-bottom: 1px solid #F4F4F4;
				padding-left: 8px;
				border-radius: 6px 6px 0 0 ;

				.cardTitle {
					padding-left: 20px;
					font-size: 16px;
					font-weight: 500;
					letter-spacing: 0px;
					line-height: 0px;
					color: rgba(51, 51, 51, 1);
					line-height: 40px;
					position: relative;

				}

				.cardTitle::before {
					content: '';
					display: inline-block;
					width: 4px;
					height: 16px;
					left: 5px;
					top: 3px;
					position: absolute;
					opacity: 1;
					background: rgba(72, 186, 91, 1);
				}
			}	
.list-item {
  padding: 10px;
  border-bottom: 1px solid #eee;
}
.header {
  display: flex;
  justify-content: space-between;
}
.title {
  font-weight: bold;
}
.distance {
  color: #999;
}
.content {
  margin-top: 5px;
}	
.content2 {
  margin-top: 5px;
  color: gray;
}	
  /* #ifndef APP-NVUE */
  page {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background-color: #fff;
    min-height: 100%;
    height: auto;
  }

  view {
    font-size: 14px;
    line-height: inherit;
  }

  /* #endif */

  .text {
    text-align: center;
    font-size: 26rpx;
    margin-top: 10rpx;
  }
.grid-body {
  
}

.circle-background {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 80px;
  // height: 80px;
  // border-radius: 100px;
  // background-color: #f1f1ff;
  // margin-bottom: 8px;
}

.text {
  margin-top: 8px;
  font-size: 14px;
  color: #333;
}
.grid-item-box {
    flex: 1;
    /* #ifndef APP-NVUE */
    display: flex;
    /* #endif */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
  }

.uni-margin-wrap {
    width: 690rpx;
    width: 100%;
    ;
  }

.swiper {
    height: 300rpx;
  }

.swiper-box {
    height: 150px;
  }

.swiper-item {
    /* #ifndef APP-NVUE */
    display: flex;
    /* #endif */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    height: 300rpx;
    line-height: 300rpx;
  }

@media screen and (min-width: 500px) {
    .uni-swiper-dot-box {
      width: 400px;
      /* #ifndef APP-NVUE */
      margin: 0 auto;
      /* #endif */
      margin-top: 8px;
    }

    .image {
      width: 100%;
    }
  }
</style>
